<template>
  <div></div>
</template>

<script lang='ts'>
import {Vue,Options} from 'vue-class-component';
import { Toast } from "vant";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
@Options({
  name: 'Splash',
  components:{
  }
})
export default class Splash extends Vue{

    store: any = useStore(); //仓库对象
    
    router = useRouter(); //路由对象，用来进行路由跳转 
    
    public created():void {
       this.init()
    }

    init(): void{
      Toast.loading({
        type:"loading",
        message:"请稍后"
      })
      
      if(this.store.state.userInfo.token){
          setTimeout(()=>{this.router.push('/home'),Toast.clear()},1000)
      }else{
          setTimeout(()=>{this.router.push('/login'),Toast.clear()},1000)
      }
    }
}
</script>

<style scoped lang='scss'>
</style>